package com.pw.ba.base.service.impl;

import com.pw.ba.base.mapper.IGoodsOrderMapper;
import com.pw.ba.base.pojo.Address;
import com.pw.ba.base.pojo.GoodsDetail;
import com.pw.ba.base.pojo.Order;
import com.pw.ba.base.service.GoodsDetailService;
import com.pw.ba.base.service.GoodsOrderService;
import com.sun.org.apache.xpath.internal.operations.Or;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class GoodsOrderServiceImpl implements GoodsOrderService {

    @Autowired
    IGoodsOrderMapper iGoodsOrderMapper;

    @Override
    public void creatOrder(ArrayList<Order> list) {
        for (int i = 0; i < list.size(); i++) {
            Order order = list.get(i);
            iGoodsOrderMapper.creatOrder(order);
        }
    }

    @Override
    public void creatOrderAddress(Address address) {
        iGoodsOrderMapper.creatOrderAddress(address);
    }

    @Override
    public void creatUserOrder(String userId, String orderId, int totalPrice) {
        iGoodsOrderMapper.creatUserOrder(userId,orderId,totalPrice);
    }
}
